<?php
declare (strict_types = 1);

namespace app\admin\validate;

use think\Validate;

class cate extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'parent_id'  =>  'require',
        'cate_name'  =>  'require|max:20',
        'sort_order' => 'require|between:0,255',
    ];
    protected $field = [
        'parent_id'  =>  '上级分类',
        'cate_name'  =>  '分类标题',
        'sort_order' =>  '排序值',
    ];
    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'parent_id'  =>  '请选择上级分类!',
        'cate_name'  => '分类标题不能超过20个字符！',
        'sort_order' => '排序值必须在0~255之间!',

    ];

    protected $scene = [
        'edit'  =>  ['parent_id','cate_name','sort_order'],
    ];
}
